package method

import (
	"encoding/json"
	"protection/user/types"
)

type UserService struct{}

func (u *UserService) ParseToken(token string, res *map[string]interface{}) error {

	login, err := types.ParseSign("44872", token)
	(*res)["data"], _ = json.Marshal(login)
	// logger.Info("token:", token, login)
	// (*res)["data"] = []byte("hello")
	// logger.Info("login:", login, err)
	if err != nil {
		(*res)["state"] = 401
		(*res)["err"] = err
	} else {
		(*res)["state"] = 200
	}
	return nil
}

type UserStruct struct {
	ID       int    `json:"id"`
	Name     string `json:"name"`
	Email    string `json:"email"`    //登陆账户
	Password string `json:"password"` //登陆密码
	Code     string `json:"code"`
}
